package il.ac.tau.cg.ex5.lighting;

import il.ac.tau.cg.ex5.config.SceneConstants;

import javax.media.opengl.GL2;
import javax.media.opengl.fixedfunc.GLLightingFunc;

public class DirectedLighter extends Lighter
{
	private static final String NAME = "Directed light";
	
	private static final float[] DIRECTION = {
			SceneConstants.DIRECTED_LIGHT_X_DIR,
			SceneConstants.DIRECTED_LIGHT_Y_DIR,
			SceneConstants.DIRECTED_LIGHT_Z_DIR, 0.0f };
	
	private static final float[] AMBIENT = { 0.2f, 0.2f, 0.2f, 1.0f };
	private static final float[] DIFFUSE = { 1.0f, 1.0f, 1.0f, 1.0f };
	
	@Override
	protected void internalSetLighting(GL2 gl)
	{ 
		gl.glEnable(GLLightingFunc.GL_LIGHT1);
		
		gl.glLightfv(GLLightingFunc.GL_LIGHT1, GLLightingFunc.GL_AMBIENT, AMBIENT, 0);
		gl.glLightfv(GLLightingFunc.GL_LIGHT1, GLLightingFunc.GL_DIFFUSE, DIFFUSE, 0);
		gl.glLightfv(GLLightingFunc.GL_LIGHT1, GLLightingFunc.GL_POSITION, DIRECTION, 0);
	}
	
	@Override
	public String getName()
	{
		return NAME;
	}
}
